<template>
  <el-scrollbar>
    <div class="mvrank">
      <div class="info">
        <div class="mvrank-con">
          <div class="mvrank-select">
            <ul>
              <li v-for="(item,index) in rankselect" :key="index" @click="rankselectnum=index" :class="{'c62e2e':rankselectnum===index}">{{item}}</li>
            </ul>
          </div>
          <div class="mvrank-container">
            <ul>
              <li v-for="(item,index) in ranklist" :key="index" class="imgli">
                <span class="mvrank-index"><i>{{index+1 | filterNumber}}</i></span>
                <div class="mvrank-img">
                  <img v-lazy="item.cover"/>
                  <span class="playnum"><i class="el-icon-view"></i>{{item.playCount}}</span>
                </div>
                <div class="mvrank-name ellipsis">
                  <p class="ellipsis">{{item.name}}</p>
                  <p class="ellipsis">{{item.artistName}}</p>
                  <p class="ellipsis">{{item.briefDesc}}</p>
                </div>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </el-scrollbar>
</template>
<script>
  import {getMVRank} from '@/api/api'
  export default {
    data() {
      return {
        rankselect:['内地','港台','欧美','日本','韩国'],
        rankselectnum: 0,
        ranklist:[], //排行榜列表
      }
    },
    methods:{
      _getmvrank(){
        getMVRank().then(res=>{
          if(res.status == 200){
            this.ranklist = res.data.data;
            // console.log(this.ranklist)
          }
        })
      }
    },
    mounted() {
      this._getmvrank();
    }
  }
</script>
<style scoped="scoped">
  .mvrank {
    width: 100%;
    height: auto;
    padding: 20px 28px;
  }

  .mvrank-select ul{
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #999999;
  }
  .mvrank-select ul li{
    padding: 0 10px;
    border-right: 1px solid #E4E4E7;
  }
  .mvrank-container ul{
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .mvrank-container ul li{
    display: flex;
    align-items: center;
    margin: 20px 0px 20px 0px;
    width: 50%;
  }
  .mvrank-index{
    display: block;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999999;
    font-size: 20px;
  }
  .mvrank-img{
    width: 227px;
    height: 128px;
    overflow: hidden;
    position: relative;
  }
  .mvrank-img img{
    display: block;
    width: 100%;
  }
  .mvrank-name{
    flex: 1;
    display: flex;
    justify-content: center;
    flex-direction: column;
    padding-left: 10px;
    padding-right: 20px;
  }
  .mvrank-name p{
    line-height: 26px;
    font-size: 12px;
    color: #999999;
  }
  .mvrank-name p:nth-of-type(1){
    color: #000000;
    font-size: 14px;
  }
</style>
